package ch.gislb2.helpers;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;

public class LogItem {
	
	private double sensorFusionValue;
	private int accuracySensorFusion, accuracyACCELEROMETER, accuracyMAGNETIC_FIELD, accuracyGyro;
	private String separator = ";";
	private String timestamp;
	private DateFormat dfmt = new SimpleDateFormat( "dd.MM.yyyy HH:mm:ss.SSS" );
	
	public LogItem(double sensorFusionValue, int accuracySensorFusion, int accuracyAccelerometer, int accuracyMagneticField,
			int accuracyGyro)
	{
		this.sensorFusionValue = sensorFusionValue;
		this.accuracySensorFusion = accuracySensorFusion;
		this.accuracyACCELEROMETER = accuracyAccelerometer;
		this.accuracyGyro = accuracyGyro;
		this.accuracyMAGNETIC_FIELD = accuracyMagneticField;
		Calendar now = new GregorianCalendar();
		this.timestamp = dfmt.format(now.getTime());
	}
	
	public double getSensorFusionValue() {
		return sensorFusionValue;
	}
	public void setSensorFusionValue(double sensorFusionValue) {
		this.sensorFusionValue = sensorFusionValue;
	}
	public int getAccuracyMAGNETIC_FIELD() {
		return accuracyMAGNETIC_FIELD;
	}
	public void setAccuracyMAGNETIC_FIELD(int accuracyMAGNETIC_FIELD) {
		this.accuracyMAGNETIC_FIELD = accuracyMAGNETIC_FIELD;
	}
	public int getAccuracyGyro() {
		return accuracyGyro;
	}
	public void setAccuracyGyro(int accuracyGyro) {
		this.accuracyGyro = accuracyGyro;
	}
	public int getAccuracyACCELEROMETER() {
		return accuracyACCELEROMETER;
	}
	public void setAccuracyACCELEROMETER(int accuracyACCELEROMETER) {
		this.accuracyACCELEROMETER = accuracyACCELEROMETER;
	}


	
	
	@Override
	public String toString() {
		
		return this.timestamp + this.separator + this.sensorFusionValue + this.separator+this.accuracySensorFusion+
				this.separator + this.accuracyACCELEROMETER + this.separator + this.accuracyGyro+
				this.separator + this.accuracyMAGNETIC_FIELD;
	}

	
	

}
